package com.zyj.utils.d3;

import com.zyj.utils.d3.base.LineUtils;
import com.zyj.utils.d3.entity.Point;

public class Demo {
    public static void main(String[] args) {
        //投影垂直
//		double x1 = 0, y1 = 0, z1 = 0;
//		double x2 = 2, y2 = 2, z2 = 2;
//		double x3 = 0, y3 = 0, z3 = 1;
//		double x4 = 1, y4 = 0, z4 = 0;
        //相交
//        double x1 = -1, y1 = -1, z1 = -1;
//		double x2 = 1, y2 = 1, z2 = 1;
//		double x3 = -1, y3 = 1, z3 = -1;
//		double x4 = 1, y4 = -1, z4 = 1;
        //平行(1, 0, 0)-(-1, 0, 0)   (0, 0, 1)-(4, 0, 1)
//        double x1 = 1, y1 = 0, z1 = 0;
//        double x2 = -1, y2 = 0, z2 = 0;
//        double x3 = 0, y3 = 0, z3 = 1;
//        double x4 = 4, y4 = 0, z4 = 1;
        //重合
//		double x1 = 0, y1 = 0, z1 = 0;
//		double x2 = 0, y2 = 0, z2 = 5;
//		double x3 = 0, y3 = 0, z3 = -1;
//		double x4 = 0, y4 = 0, z4 = -3;
        //垂直有交点
//		double x1 = 1, y1 = 0, z1 = 0;
//		double x2 = -1, y2 = 0, z2 = 0;
//		double x3 = 0, y3 = 1, z3 = 0;
//		double x4 = 0, y4 = -1, z4 = 0;
        //其他：垂直平面内
//        double x1 = 0, y1 = 0, z1 = 1;
//        double x2 = 0, y2 = 0, z2 = 3;
//        double x3 = 3, y3 = 3, z3 = 5;
//        double x4 = 4, y4 = 9, z4 = 5;

//        double x1 = 4, y1 = -0, z1 = -0;
//        double x2 = 0, y2 = 3, z2 = 0;
//        double x3 = 4, y3 = 3, z3 = 1;
//        double x4 = 4, y4 = 3, z4 = -4;

        double x1 = 196.2311111, y1 = 267.39222233333, z1 = -49.053212312312312;
        double x2 = 196.36111111, y2 = 267.11333333, z2 = -49.031231231230;
//        0.1	-0.28 0.05
        double x3 = 198.46, y3 = 263.93, z3 = -50;
        double x4 = 196.48, y4 = 267.41, z4 = -50;
//        0.02 3.48 0

        Point A = new Point(x1, y1, z1);
        Point B = new Point(x2, y2, z2);

        Point C = new Point(x3, y3, z3);
        Point D = new Point(x4, y4, z4);
        double dist = D3Utils.SegmentUtils.calculateSegmentsDist(A, B, C, D);


//		int[][] a = new int[][]{{0, 0, 2}, {1, 0, 0}, {1, 0, 0}};
//		System.out.println(MathUtils.det(a));


//        SegmentUtils.computeDist(l1p1, l1p2, l2p1, l2p2);

//        double qp = SegmentUtils.calculatePointToLineDist(l1p1, l2p1, l2p1);



        System.out.println("最短距离1：" + dist);
        dist = LineUtils.computeLineDist(A, B, C, D);
//        dist = D3Utils.SegmentUtils.computeNotParalleSegmentsDist(A, B, C, D);
        System.out.println("最短距离2：" + dist);



    }
}
